package com.jzo2o.customer.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.jzo2o.customer.model.domain.AgencyCertification;
import com.jzo2o.customer.model.dto.AgencyCertificationUpdateDTO;
import com.jzo2o.customer.model.dto.request.AgencyCertificationAuditPageQueryReqDTO;
import com.jzo2o.customer.model.dto.response.RejectReasonResDTO;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Update;

import java.util.List;

/**
 * <p>
 * 机构认证信息表 Mapper 接口
 * </p>
 *
 * @author itcast
 * @since 2023-09-06
 */
public interface AgencyCertificationMapper extends BaseMapper<AgencyCertification> {

    RejectReasonResDTO getReason(Long agencyId);
    List<AgencyCertificationUpdateDTO> queryWorkList(AgencyCertificationAuditPageQueryReqDTO agencyCertificationAuditPageQueryReqDTO);
    @Update("UPDATE agency_certification SET reject_reason = #{rejectReason}, audit_status = 1 WHERE id = #{id}")
    void updateCertificationStatus( Long id, @Param("rejectReason") String rejectReason);
    @Insert("INSERT INTO agency_audit (agency_id) VALUES (#{agencyId})")
    void setAuditId(Long agencyId);

    @Update("UPDATE agency_certification SET audit_status = 0 WHERE id = #{agencyId}")
    void setAuditStatus( Long agencyId);

}
